import {colorRange, colors, legend, tooltip} from "@/package/widget/chart/01base/util";

const data = {
  "lines": [
    {
      "start": [114.3896, 30.6628],
      "end": [102.8468,24.87951],
      "value": 60
    },
    {
      "start": [114.3896, 30.6628],
      "end": [ 87.6033,43.82109],
      "value": 50
    },
    {
      "start": [114.3896, 30.6628],
      "end": [104.10205, 30.662],
      "value": 33
    },
    {
      "start": [114.3896, 30.6628],
      "end": [114.3385, 30.6251],
      "value": 22
    },
    {
      "start": [114.3896, 30.6628],
      "end": [111.6893, 28.9886],
      "value": 11
    },
    {
      "start": [114.3896, 30.6628],
      "end": [110.3467, 41.4899],
      value: 80
    }
  ],
  "effectScatter": [
    {
      "name": "大连",
      "value": [
        121.6106,
        38.9137,
        20
      ]
    },
    {
      "name": "上海",
      "value": [
        121.4721,
        31.2417,
        10
      ]
    }
  ],
  "mapData": [
    {
      "name": "云南",
      "value": 2
    },
    {
      "name": "新疆",
      "value": 2
    },
    {
      "name": "四川",
      "value": 60
    },
    {
      "name": "湖北",
      "value": 80
    },
    {
      "name": "湖南",
      "value": 40
    },
    {
      "name": "青海",
      "value": 20
    },
    {
      "name": "西藏",
      "value": 10
    },
    {
      "name": "福建",
      "value": 60
    },
    {
      "name": "广东",
      "value": 120
    },
    {
      "name": "辽宁",
      "value": 6
    },
    {
      "name": "黑龙江",
      "value": 116
    }
  ]
}

export default {
  name: '基础地图',
  icon: '/img/chart/map1.png',
  type: '地图',
  cptKey: 'map01',
  width: 1000,
  height: 800,
  dynamic: true,
  options: {
    cptDataForm: {
      dataText: JSON.stringify(data),
      dataSource: 1,
      pollTime: 0
    },
    attribute: {
      mapData: {
        show: true,
        label: {
          show: false,
          formatter: null,
          formatterFn: ''
        }
      },
      lineData: {
        show: true,
        lineStyle: {
          color: null,
          width: 1,
          type: 'solid',
          shadowBlur: 0,
          shadowColor: '#00FF48',
          shadowOffsetX: 0,
          shadowOffsetY: 0,
          opacity: 1,
          curveness: 0.3
        },
        symbol: 'arrow',
        symbolSize: 5,
        color: null
      },
      color: colors,
      colorRange,
      legend,
      tooltip: {
        ...tooltip,
        trigger: 'item'
      },
      effectScatter: {
        show: false,
        rippleEffect: {
          number: 3, // 波纹数量
          period: 4, // 动画周期
          scale: 2.5, // 缩放比例
          brushType: 'fill', // stroke、fill
        },
        symbolSize: 10,
        symbolSizeFn: '',
        label: {
          show: false,
          color: '#FFF',
          fontSize: 12,
          formatter: '{b}',
          formatterFn: ''
        },
        itemStyle: {
          color: ''
        }
      },
      visualMap: {
        //图例值控制
        able: true,
        min: 1,
        max: 100,
        calculable: true,
        show: true,
        color: ['#f44336', '#fc9700', '#ffde00', '#ffde00', '#00eaff'],
        textStyle: {
          color: '#fff',
        },
      },
      geo: {
        province: '01',
        city: '',
        map: 'china',
        show: true,
        roam: false, // scale缩放、move平移、true都开启、false都关闭
        center: [], // 当前视角的中心点
        aspectScale: 0.75, // 长宽比
        zoom: 1, // 缩放比例
        zlevle: 0,
        label: {
          show: true,
          formatter: '',
          formatterFn: '',
          color: '#fff',
          fontWeight: 'normal',
          fontSize: 12
        },
        itemStyle: {
          colorType: '2', // 0 纯色， 1 线性渐变， 2径向渐变
          areaColor: '#FFF',
          linear: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: "#1cfbfe", // 0% 处的颜色
              },
              {
                offset: 1,
                color: "#3348e7", // 100% 处的颜色
              },
            ],
            global: false
          },
          radial: {
            type: 'radial',
            x: 0.5,
            y: 0.5,
            r: 0.8,
            colorStops: [{
              offset: 0,
              color: 'rgba(143, 235, 231, 0)' // 0% 处的颜色
            }, {
              offset: 1,
              color: 'rgba(143, 235, 231, .2)' // 100% 处的颜色
            }],
            global: false
          },
          borderColor: 'rgba(147, 235, 248, 1)',
          borderWidth: 1,
          borderType: 'solid', // solid、dashed、dotted
          borderDashOffset: 0,
          shadowBlur: 0,
          shadowColor: '',
          shadowOffsetX: 0,
          shadowOffsetY: 0,
          opacity: 1
        },
        emphasis: {
          label: {
            show: true,
            formatter: '',
            formatterFn: '',
            color: '#fff',
            fontWeight: 'normal',
            fontSize: 12
          },
          itemStyle: {
            colorType: '0', // 0 纯色， 1 线性渐变， 2径向渐变
            areaColor: '#389bb7',
            linear: {
              type: 'radial',
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [
                {
                  offset: 0,
                  color: "#1cfbfe", // 0% 处的颜色
                },
                {
                  offset: 1,
                  color: "#3348e7", // 100% 处的颜色
                },
              ],
              global: false
            },
            radial: {
              type: 'radial',
              x: 0.5,
              y: 0.5,
              r: 0.8,
              colorStops: [{
                offset: 0,
                color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
              }, {
                offset: 1,
                color: 'rgba(147, 235, 248, 0.2)' // 100% 处的颜色
              }],
              global: false
            },
            borderColor: '#000',
            borderWidth: 0,
            borderType: 'solid', // solid、dashed、dotted
            borderDashOffset: 0,
            shadowBlur: 0,
            shadowColor: '',
            shadowOffsetX: 0,
            shadowOffsetY: 0,
            opacity: 1
          }
        }
      }
    }
  }
}
